<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        iframe{
            width: 500px;
            height: 500px;
        }
    </style>
</head>

<body>
    <button>打开新页面</button>
    <iframe name="myframe" src="" frameborder="0"></iframe>
    <script>
        var w;
        document.querySelector("button").onclick = function() {
            w = window.open("test2.html", "_self")
            
        }
    </script>
</body>

</html>
